﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Smart.Navigation;
using Smart.Navigation.Parameter;

namespace NavigationSampleApp.Views
{
    /// <summary>
    /// 
    /// </summary>
    [View(ViewId.DataDetailNew)]
    [View(ViewId.DataDetailEdit)]
    public partial class DataDetailView : AppViewBase
    {
        [ViewParameter(Direction.Import)]
        protected string selectedId;

        /// <summary>
        /// 
        /// </summary>
        public DataDetailView()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void OnViewOpen(ViewForwardEventArgs args)
        {
            if( (ViewId)args.ViewId == ViewId.DataDetailEdit )
            {
                FormControl.SetTitle( "編集データID " + this.selectedId );
            }
            else
            {
                FormControl.SetTitle( "新規作成" );
            }
            FormControl.SetButtonLeft( "戻る" );
            FormControl.SetButtonRight( null );
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonLeft()
        {
            Navigator.Pop();
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonRight()
        {
        }
    }
}
